﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;

using CE.Database;
using CE.CarInsurance;
using CE.Configuration;
using CE.Mail;
using CE.Global;
public partial class Quote_Result : MyLanguageBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[General.CarId] != null && Session[General.CarId] != null)
        {
            if (!Page.IsPostBack)
            {
                //Session["CarID"] = "13054";
                //Session["UserID"] = "834";
                //Session["UserEmail"] = "phyokyawthant@gmail.com";

                if (Session[General.UserId] != null)
                {
                    Cache.Remove("CarResult" + Session[General.UserId].ToString() + Session[General.CarId].ToString());
                }
                else
                {
                    Cache.Remove("CarResult" + Session[General.CarId].ToString());
                }

                CalculatePremium();
                GetTempResultTableTwo();
            }
        }
        else
        {
            Response.Redirect("quote.aspx");
        }


    }

    private Int32 CalculatePremium()
    {
        MyDatabase _db = new MyDatabase();

        SortedList _sPara = new SortedList();
        _sPara.Add("@CarId", Session[General.CarId].ToString());
        Int64 _carId = Convert.ToInt64(Session[General.CarId].ToString());
        Int64 _userId = 0;
        BKIDetailDB bki = new BKIDetailDB();

        if (Session[General.UserId] != null)
        {
            _userId = Convert.ToInt64(Session[General.UserId].ToString());
        }
        _sPara.Add("@RefUserId", _userId);

        Int32 _result = 0;

        _db.ExecuteNonSqlSP("[sprocProviderCarInsuranceClear]", _sPara);

        //====Test Web Service
        try
        {
            bki.BKICalculation(_carId, _userId);
        }
        catch
        {
        }

        _result = _db.ExecuteNonSqlSP("[sprocProviderCarInsuranceCalculation]", _sPara);

        return _result;
    }

    protected void dlCarResults_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item ||
             e.Item.ItemType == ListItemType.AlternatingItem)
        {
            ImageButton imgEmailQuote = (ImageButton)e.Item.FindControl("imgEmailQuote");
            imgEmailQuote.Attributes.Add("onclick", "return confirm('Are you sure you want to send this quote?');");

            Label lblPremiumAmount = (Label)e.Item.FindControl("lblPremiumAmount");
            Label lblPromotionPrice = (Label)e.Item.FindControl("lblPromotionPrice");

            Label lblProviderCompanyName = (Label)e.Item.FindControl("lblProviderCompanyName");

            Label lblPlanName = (Label)e.Item.FindControl("lblPlanName");
            Label lblProviderCompanyID = (Label)e.Item.FindControl("lblProviderCompanyID");
            Label lblCarResultID = (Label)e.Item.FindControl("lblCarResultID");
            Image imgProviderCompanyLogo = (Image)e.Item.FindControl("imgProviderCompanyLogo");

            string _promotionPrice = DataBinder.Eval(e.Item.DataItem, "PromotionPrice").ToString().Trim();
            string _premiumAmount = DataBinder.Eval(e.Item.DataItem, "AnnualPremium").ToString().Trim();

            lblPromotionPrice.Text = "(฿) " + Convert.ToSingle(_promotionPrice).ToString("#,000.00");

            if (_promotionPrice != _premiumAmount)
            {
                lblPremiumAmount.Text = "(฿) " + Convert.ToSingle(_premiumAmount).ToString("#,000.00");
            }

            //string _promotion = DataBinder.Eval(e.Row.DataItem, "PromotionPrice").ToString().Trim();
            //string _premium = DataBinder.Eval(e.Row.DataItem, "AnnualPremium").ToString().Trim();

            //Label lblPromotionPrice = (Label)e.Row.FindControl("lblPromotionPrice");
            //Label lblPremiumPrice = (Label)e.Row.FindControl("lblPremiumPrice");

            //lblPromotionPrice.Text = Convert.ToSingle(_promotion).ToString("#,000.00");
            //if (_promotion != _premium)
            //{
            //    lblPremiumPrice.Text = Convert.ToSingle(_premium).ToString("#,000.00");
            //}

            lblProviderCompanyID.Text = DataBinder.Eval(e.Item.DataItem, "ProviderCompanyId").ToString();
            lblProviderCompanyName.Text = DataBinder.Eval(e.Item.DataItem, "CompanyName").ToString();
            lblPlanName.Text = DataBinder.Eval(e.Item.DataItem, "PackageName").ToString();
            lblCarResultID.Text = DataBinder.Eval(e.Item.DataItem, "CITempResultID").ToString();

            HyperLink hlnkView = (HyperLink)e.Item.FindControl("hlnkView");
            hlnkView.NavigateUrl = "~/Quote_Result_Detail.aspx?crid=" + lblCarResultID.Text;

            HyperLink hlnkViewTop = (HyperLink)e.Item.FindControl("hlnkViewTop");
            hlnkViewTop.NavigateUrl = "~/Quote_Result_Detail.aspx?crid=" + lblCarResultID.Text;

            imgProviderCompanyLogo.ImageUrl = "http://www.gluaygluay.com" + DataBinder.Eval(e.Item.DataItem, "CompanyLogoServerUrl").ToString();
        }
    }

    private void GetTempResultTableTwo()
    {
        MyDatabase _db = new MyDatabase();
        DataTable _dtResult = new DataTable();
        string _spName = "[sprocCarInsuranceResultSelectItemList]";
        SortedList _sPara = new SortedList();
        //_sPara.Add("@CECarId", Session[General.CarId].ToString());
        _sPara.Add("@CarId", Session[General.CarId].ToString());

        if (Session["UserID"] != null)
        {
            _sPara.Add("@RefUserId", Session[General.UserId].ToString());
        }
        else
        {
            _sPara.Add("@RefUserId", 0);
        }

        _dtResult = _db.GetDataTableBySP(_spName, _sPara);

        dlCarResults.DataSource = null;
        dlCarResults.DataSource = _dtResult;
        dlCarResults.DataBind();

        if (Session[General.UserId] != null)
        {
            if (Session[General.CarId] != null)
            {
                Cache["CarResult" + Session[General.UserId].ToString() + Session[General.CarId].ToString()] = _dtResult;
            }
        }
        else
        {
            if (Session[General.CarId] != null)
            {
                Cache["CarResult" + Session[General.CarId].ToString()] = _dtResult;
            }
        }

        if (dlCarResults.Items.Count <= 0)
        {
            lblNoResultMessage.Text = "<div class='pad_10'><h2>No Matches Found!</h2><span class='font_12'><strong>Please take note that there are no matches found based on your details entered.</strong></span><div class='seperator'></div><div class='seperator'></div>You can also return to our <a href='/'>homepage</a> or our dedicated <a href='quote.aspx'>car insurance quote</a> page to re-quote.<div class='seperator'></div>Thank you for using กล้วยๆ.com.</div>";
        }
        else
        {
            lblNoResultMessage.Text = "( " + dlCarResults.Items.Count + " ) packages found <br/><br/>";
        }
    }

    protected void dlCarResults_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "Email")
        {
            //Label lblPremiumAmount = (Label)e.Item.FindControl("lblPremiumAmount");
            //Label lblPromotionPrice = (Label)e.Item.FindControl("lblPromotionPrice");
            //Label lblProviderCompanyName = (Label)e.Item.FindControl("lblProviderCompanyName");
            //Label lblPlanName = (Label)e.Item.FindControl("lblPlanName");
            //Label lblProviderCompanyID = (Label)e.Item.FindControl("lblProviderCompanyID");
            //Image imgProviderCompanyLogo = (Image)e.Item.FindControl("imgProviderCompanyLogo");
            Label lblCarResultID = (Label)e.Item.FindControl("lblCarResultID");

            this.EmailQuote(lblCarResultID.Text);

        }



        if (e.CommandName == "ViewDetails")
        {
            //e.Item.DataItem
            Label lblCarResultID = (Label)e.Item.FindControl("lblCarResultID");

            if (lblCarResultID.Text.Trim() != "")
            {
                //Session["CarSelected"] = lblCarResultID.Text;
                Response.Redirect("quote_result_detail.aspx?crid=" + lblCarResultID.Text);
            }
        }
    }

    private void EmailQuote(string carresultid)
    {
        string qs_carselected = carresultid;
        string _makemodel = "";
        string _garagetype = "";
        string _caryear = "";
        string _ncb = "";
        string _policystartdate = "";

        Int64 _cecarid = 0;

        if (Session[General.CarPolicyId] != null && Session[General.CarId] != null)
        {
            _cecarid = Convert.ToInt64(Session[General.CarId]);
            Int64 _cepolicyid = Convert.ToInt64(Session[General.CarPolicyId]);
            Int64 _userId = 0;

            if (Session[General.UserId] != null)
            {
                _userId = Convert.ToInt64(Session[General.UserId].ToString());
            }

            CarDetailTH _cardetail = new CarDetailTH();
            CarDetailTHDB _cardetaildb = new CarDetailTHDB();
            _cardetail = _cardetaildb.GetCar(_cecarid, _userId);

            CarPolicy _carpolicy = new CarPolicy();
            CarPolicyDB _carpolicydb = new CarPolicyDB();
            _carpolicy = _carpolicydb.GetCarPolicy(_cecarid, _cepolicyid, _userId);

            if (_cardetail != null)
            {
                _makemodel = _cardetail.CarModelName + " " + _cardetail.Body + " " + _cardetail.CC + "cc " + _cardetail.Door.ToString() + " doors";
                _caryear = _cardetail.ManufactYear.ToString();
            }

            if (_carpolicy != null)
            {
                if (_carpolicy.GarageType.ToString().Trim() == "1")
                    _garagetype = Resources.CarInsurance.Garage_Authorized;
                else
                    _garagetype = Resources.CarInsurance.Garage_Dealer;

                _ncb = _carpolicy.NCDPercent.ToString();
                _policystartdate = _carpolicy.CoverageCommenceDate.ToString("dd/MMM/yyyy");
            }
        }

        string _refno = "";
        string _companyName = "";
        string _insurerimageurl = "";
        string _package = "";
        string _annualprice = "";
        string _excess = "";

        bool _isDamageShowImage = false;
        string _damage = "";
        bool _isFireShowImage = false;
        string _fire = "";
        bool _isTheftShowImage = false;
        string _theft = "";
        string _medicalexp = "";
        string _losspe = "";
        string _lossuse = "";
        string _padriver = "";
        string _tppd = "";
        string _bailbond = "";
        bool _isFloodCovered = false;

        if (qs_carselected != "" && Session[General.UserId] != null && Session[General.CarId] != null && Session[General.UserName] != null)
        {
            if (Cache["CarResult" + Session[General.UserId].ToString() + Session[General.CarId].ToString()] != null)
            {
                DataView dv = new DataView((DataTable)Cache["CarResult" + Session[General.UserId].ToString() + Session[General.CarId].ToString()]);

                string CITempResultId = qs_carselected; // Session["CarSelected"].ToString();

                //dv.RowFilter = " CITempResultId in (" + CITempResultId.Remove(CITempResultId.Length - 1, 1) + ")";
                dv.RowFilter = " CITempResultId in (" + CITempResultId + ")";
                DataTable dtFiltered = dv.ToTable();
                if (Cache["CarResult" + Session[General.UserId].ToString() + Session[General.CarId].ToString()] != null)
                {
                    if (dtFiltered.Rows.Count > 0)
                    {
                        int rowCount = dtFiltered.Rows.Count;

                        for (int iRows = 0; iRows < rowCount; iRows++)
                        {
                            //string convertno = General.GetRefNumber(_cecarid);

                            string _providercompanyid = dtFiltered.Rows[iRows]["ProviderCompanyId"].ToString();
                            _refno = General.GetReferenceNumber(_cecarid.ToString(), _providercompanyid);

                            if (Session["Language"] != null)
                            {
                                if (Session["Language"].ToString() == "th-TH")
                                    _companyName = General.GetProviderName(int.Parse(_providercompanyid), "1");
                                else
                                    _companyName = General.GetProviderName(int.Parse(_providercompanyid), "2");
                            }
                            else
                            {
                                //english
                                _companyName = General.GetProviderName(int.Parse(_providercompanyid), "2");
                            }


                            _insurerimageurl = CE.Global.General.GetProviderCompanyLogo(_providercompanyid);

                            _package = "<strong>" + dtFiltered.Rows[iRows]["packagename"].ToString() + "</strong>";


                            if (Convert.ToSingle(dtFiltered.Rows[iRows]["annualpremium"]) != Convert.ToSingle(dtFiltered.Rows[iRows]["promotionprice"]))
                            {
                                _annualprice = "<s>" + String.Format("{0:0,0.00}", Convert.ToSingle(dtFiltered.Rows[iRows]["annualpremium"].ToString())) + "</s>";
                            }

                            _annualprice = _annualprice + "<div style='color:#F00;font-size:20px;font-weight:bold;' >";
                            _annualprice = _annualprice + String.Format("{0:0,0.00}", Convert.ToSingle(dtFiltered.Rows[iRows]["promotionprice"].ToString())); //"999.00";
                            _annualprice = _annualprice + "</div>";

                            //string _promotion = DataBinder.Eval(e.Row.DataItem, "PromotionPrice").ToString().Trim();
                            //string _premium = DataBinder.Eval(e.Row.DataItem, "AnnualPremium").ToString().Trim();

                            //Label lblPromotionPrice = (Label)e.Row.FindControl("lblPromotionPrice");
                            //Label lblPremiumPrice = (Label)e.Row.FindControl("lblPremiumPrice");

                            //lblPromotionPrice.Text = Convert.ToSingle(_promotion).ToString("#,000.00");
                            //if (_promotion != _premium)
                            //{
                            //    lblPremiumPrice.Text = Convert.ToSingle(_premium).ToString("#,000.00");
                            //}


                            if (Convert.ToSingle(dtFiltered.Rows[iRows]["DEC"].ToString()) == 0)
                            {
                                _excess = Resources.CarInsuranceResultPage.Waived;
                            }
                            else
                            {
                                _excess = String.Format("{0:0,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["DEC"].ToString()));
                            }

                            if (Convert.ToSingle(dtFiltered.Rows[iRows]["SumInsured"].ToString()) == 0)
                            {
                                _isDamageShowImage = true;
                            }
                            else
                            {
                                _damage = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["SumInsured"].ToString()));
                            }


                            if (Convert.ToInt32(dtFiltered.Rows[iRows]["Fire"].ToString()) == 0)
                                _isFireShowImage = true;
                            else
                                _fire = String.Format("{0:#,0}", Convert.ToInt32(dtFiltered.Rows[iRows]["Fire"].ToString()));

                            //Theft
                            if (Convert.ToSingle(dtFiltered.Rows[iRows]["Theft"].ToString()) == 0)
                                _isTheftShowImage = true;
                            else
                                _theft = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["Theft"].ToString()));

                            _tppd = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["TPPD"].ToString()));

                            _losspe = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["TPBIA"].ToString()));

                            _lossuse = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["TPBIP"].ToString()));

                            _padriver = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["PADriver"].ToString()));

                            _medicalexp = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["MedicalExpense"].ToString()));

                            _bailbond = String.Format("{0:#,0}", Convert.ToSingle(dtFiltered.Rows[iRows]["BailBond"].ToString()));

                            if (dtFiltered.Rows[iRows]["IsFloodCover"].ToString() != "0")
                            {
                                _isFloodCovered = true;
                            }
                        }
                    }
                }
            }
        }
        string _emailList = "", _title = "";
        System.Text.StringBuilder _message = new System.Text.StringBuilder();
        _emailList = Session[CE.Global.General.UserEmail].ToString();
        //_emailList += ";team@comparexpress.com";
        //string _currentDomainUrl = "http://" + HttpContext.Current.Request.Url.Host.ToString() + "/";
        string _currentDomainUrl = "http://www.gluaygluay.com/";
        _title = "";

        _title = "gluaygluay.com (Ref No : " + _refno + ")";

        _message.Append("<table cellpadding='0' cellspacing='0' border='0' width='270' style='font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0 auto;'>");
        _message.Append("<tr><td style='border-bottom:1px solid #ccc;' align='center'><img src='" + _currentDomainUrl + "mobile/images/bg/logo_gluaygluay.png' alt='' height='78' /><br/><br/>");
        _message.Append("Thank you for choosing GluayGluay.com <br/><strong>Here is your Quote Details </strong><br /><br/></td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><br /><table cellspacing='0' cellpadding='2' width='100%' border='0'>");

        _message.Append("<tr><td valign='top'>" + Resources.ProposalForm.QuoteReferenceNumber + "</td>");
        _message.Append("<td valign='top'><strong><u>" + _refno + "</u></strong></td></tr>");

        _message.Append("<tr><td width='50%' valign='top'> " + Resources.ProposalForm.GarageType + " </td>");
        _message.Append("<td width='50%' valign='top'><strong>" + _garagetype + "</strong></td></tr>");

        _message.Append("<tr><td valign='top'>" + Resources.ProposalForm.CarMakeModel + "</td>");
        _message.Append("<td valign='top'><strong>" + _makemodel + "</strong></td></tr>");

        _message.Append("<tr><td valign='top'>" + Resources.ProposalForm.CarModelYear + "</td>");
        _message.Append("<td valign='top'><strong>" + _caryear + "</strong></td></tr>");

        _message.Append("<tr><td valign='top'>" + Resources.ProposalForm.CoverCommencementDate + "</td>");
        _message.Append("<td valign='top'><strong>" + _policystartdate + "</strong></td></tr>");

        _message.Append("<tr><td valign='top'>" + Resources.ProposalForm.NCB + "</td>");
        _message.Append("<td valign='top'><strong>" + _ncb + "</strong></td></tr>");

        _message.Append("<tr><td valign='top'>" + Resources.ProposalForm.QuoteDate + "</td>");
        _message.Append("<td valign='top'><strong>" + DateTime.Now.ToString("dd/MMM/yyyy") + "</strong></td></tr>");

        _message.Append("</table><br /></td></tr><tr><td width='360'><br />");

        _message.Append("<table width='100%' border='0' cellpadding='5' cellspacing='0'  class='table_details'>");

        _message.Append("<tr><td width='45%'></td>");
        _message.Append("<td width='55%' align='center' style='background:#e0e0e0; border-bottom:white 1px dashed;'>");
        _message.Append("<img src='" + _currentDomainUrl + _insurerimageurl + "' width='120px' /></td></tr>");

        _message.Append("<tr><td><strong>" + Resources.CarInsuranceResultPage.Insurer + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5; color:black;' ><strong>" + _companyName + "</strong></td></tr>");

        _message.Append("<tr><td></td>");
        _message.Append("<td align='center' style='background:#d5d5d5;'>" + _package + "</td></tr>");

        _message.Append("<tr><td align='left' style='background:#d5d5d5' ><strong>" + Resources.CarInsuranceResultPage.TotalVMI + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5; color:black; font-size:16px;'><strong>" + _annualprice + "</strong></td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.DEC + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >" + _excess + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.OwnDamage + "</strong></td>");
        _message.Append("<td align='center' style='background:#c5c5c5;'>");

        if (_isDamageShowImage)
            _message.Append("<img src='http://www.comparexpress.com/images/icon/X.png' /></td></tr>");
        else
            _message.Append(_damage + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.Fire + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");

        if (_isFireShowImage)
            _message.Append("<img src='http://www.comparexpress.com/images/icon/X.png' /></td></tr>");
        else
            _message.Append(_fire + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.Theft + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");

        if (_isTheftShowImage)
            _message.Append("<img src='http://www.comparexpress.com/images/icon/X.png' /></td></tr>");
        else
            _message.Append(_theft + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.TPPD + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append(_tppd + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.TPBIA + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append(_losspe + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.TPBIP + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append(_lossuse + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.PADriver + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append(_padriver + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.MED + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append(_medicalexp + "</td></tr>");

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.BailBond + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append(_bailbond + "</td></tr>");

        string imgfloodurl = "http://www.comparexpress.com/images/icon/X.png";

        if (_isFloodCovered)
            imgfloodurl = "http://www.gluaygluay.com/images/icon/flood_car.png";

        _message.Append("<tr><td style='border-bottom:1px solid #ccc;'><strong>" + Resources.CarInsuranceResultPage.FloodCover + "</strong></td>");
        _message.Append("<td align='center' style='background:#d5d5d5' >");
        _message.Append("<img src='" + imgfloodurl + "' /></td></tr>");

        _message.Append("</table><br /><br />");
        _message.Append("<a href='tel:022688222'><img src='http://www.gluaygluay.com/images/banners/hotline_en.png' alt='Call Us at 02 268 8222' width='270' border='0' /></a>");
        _message.Append("<br /><br /><br />");

        _message.Append("<strong>" + Resources.ProposalForm.Remarks + "</strong><br />");
        _message.Append(Resources.ProposalForm.RemarkOne + "<br />");
        _message.Append(Resources.ProposalForm.RemarkTwo + "<br />");
        _message.Append("</td></tr><tr><td id='email_footer'></td>");
        _message.Append("</tr></table><br /><br /><hr />" + Resources.ProposalForm.ThisQuoteis + " <br /><br />");
        _message.Append("<i>" + Resources.ProposalForm.EmailDisclaimer + "</i><hr />");

        MyMailManager.SendNotification(_emailList, _title, _message.ToString());
        Response.Redirect("email_confirm.aspx?type=email&resultid=" + carresultid);
    }

    protected void btnApply_Click(object sender, EventArgs e)
    {


    }
    protected void ibtEditQuoteDetail_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("quotedetails.aspx");
    }
}
